
#ifndef HOST_DETECTOR_ARP_TYPES_H
#define HOST_DETECTOR_ARP_TYPES_H


#include <QObject>
#include <QHostAddress>
#include <QEvent>

struct EthDev
{
    Q_GADGET
  public:
    EthDev() = default;
    EthDev(const QString& name, const QString& desc, const QHostAddress& ip, const QHostAddress& mask, const QString& mac) : name(name), desc(desc), ip{ip}, mask{mask}, mac{mac} {}
    EthDev(const EthDev& other) : name(other.name), desc(other.desc), ip(other.ip), mask(other.mask), mac(other.mac) {}

    Q_PROPERTY(QString name MEMBER name)  // 属性对 QML 可见
    Q_PROPERTY(QString desc MEMBER desc)
    // Q_PROPERTY(QString ip MEMBER ip)
    // Q_PROPERTY(QString mac MEMBER mac)

    QString name;
    QString desc;
    QHostAddress ip; // v4
    QHostAddress mask; 
    QString mac;
};

// 自定义事件类型ID
const QEvent::Type IpAppending = static_cast<QEvent::Type>(QEvent::User + 1);

struct MyEvent:public QEvent
{
    MyEvent(const QString& ip, QEvent::Type type):QEvent{type}, ip{ip}{}
    QString ip;
};

#endif // HOST_DETECTOR_ARP_TYPES_H
